<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      请输入城市/景点/游玩主题
    </div>
      <router-link class="header-right" to="/city" tag="div">
        <!-- {{this.$store.state.city}} -->
        {{this.city}}
        <span class="iconfont arrow-icon">&#xe64a;</span>
      </router-link>
  </div>
</template>

<script>
import { mapState } from 'vuex'
  export default {
    name: 'HomeHeader',
    computed: {
      //把vuex的数据映射到computed计算属性中
      ...mapState(['city'])
    }
  }
</script>

<style lang="stylus" type="text/stylus" scoped>
  @import '~styles/varibles.styl';
  .header{
    display: flex;
    height: $headerHeight;
    background-color: $bgColor;
    color: #fff;
    line-height: $headerHeight;
  }
  .header .header-left{
    width: .64rem;
    float: left;
  }
  .header .header-left .back-icon{
    text-align: center;
    font-size: .4rem;
  }
  .header .header-input{
    padding-left: .2rem;
    flex: 1;
    background: #fff;
    margin-top: .12rem;
    height: .64rem;
    margin-left: .2rem;
    border: .1rem;
    color: #ccc;
    line-height: .64rem;
    border-radius: .1rem;
  }
  .header .header-right{
    min-width: 1.04rem;
    padding: 0 .1rem;
    float: right;
    text-align: center;
  }
  .header .header-right .arrow-icon{
    margin-left: -.04rem;
    font-size: .24rem;
  }
</style>
